package main

import (
	"context"
	"git.900sui.cn/kc/base/utils"
	"git.900sui.cn/kc/kcgin"
	"git.900sui.cn/kc/kcgin/logs"
	"git.900sui.cn/kc/rabbitmq"
	risk "git.900sui.cn/kc/rpcinterface/client/risk"
	"github.com/streadway/amqp"
	"strconv"
)

func main() {
	logs.Info("Environment Variable:MSF_ENV:", kcgin.KcConfig.RunMode)
	new(utils.KcLog).GetInstance(kcgin.AppConfig.String("risk.log.shopAuditSuccess"))
	err := rabbitmq.Rabbitmq.Consume(kcgin.AppConfig.String("risk.queue.shopAuditSuccess"), func(msg amqp.Delivery) {
		shopId,err := strconv.Atoi(string(msg.Body))
		if err != nil {
			return
		}
		rpcRisk := new(risk.BusBasicIndusAvg).Init()
		defer rpcRisk.Close()
		reply := false
		if err := rpcRisk.RiskForAuditShop(context.Background(), &shopId, &reply); err != nil {
			utils.Logerr.Printf("统计行业店铺审核成功任务出错，shopId:%d error:%s\n",shopId,err.Error())
			return
		}
		return
	})
	if err != nil {
		panic(err)
	}
}
